package com.spring.arch.common.security;

import lombok.AccessLevel;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;
import java.util.UUID;

/**
 * 用户凭证信息
 *
 * @author Frank
 * @version 1.0.0.1
 * @since JDK 1.8
 */
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@Data
public class UserPrincipal implements Serializable {

    private static final long serialVersionUID = 1750420614873555393L;

    private UUID id;

    /**
     * 用户账号
     */
    private String account;

    /**
     * 用户真实姓名
     */
    private String realName;

    /**
     * 手机号
     */
    private String mobile;

    /**
     * 当前租户ID
     */
    private UUID tenantId;

    /**
     * 当前租户名称
     */
    private String tenantName;

    /**
     * 当前项目ID
     */
    private UUID projectId;

    /**
     * 当前项目名称
     */
    private String projectName;

    /**
     * 组织编码(当前项目id唯一)
     */
    private UUID orgId;

    /**
     * 组织名称(当前项目名称)
     */
    private String orgName;

    /**
     * 用户是否为部门领导
     */
    private boolean isLeader;

    /**
     * 用户所有角色
     */
    private List<String> roles;

    public UserPrincipal(UUID id, String account, String realName, String mobile, UUID tenantId, String tenantName,
                         UUID projectId, String projectName, List<String> roles, UUID orgId, String orgName, boolean isLeader) {
        this.id = id;
        this.account = account;
        this.realName = realName;
        this.mobile = mobile;
        this.tenantId = tenantId;
        this.tenantName = tenantName;
        this.projectId = projectId;
        this.projectName = projectName;
        this.roles = roles;
        this.orgId = orgId;
        this.orgName = orgName;
        this.isLeader = isLeader;
    }
}